package io.demo.hallelujahdictionary;

import lombok.extern.slf4j.Slf4j;
import org.springframework.jms.annotation.JmsListener;
import org.springframework.stereotype.Component;

import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;

/**
 * @author lijinting01
 */
@Slf4j
@Component
public class TextMessageProcessingCommandImpl implements TextMessageProcessingCommand {

	private static final String QUEUE_NAME = "QCDMSTOSJYX";

	@Override
	@JmsListener(containerFactory = "jmsListenerContainerFactory", destination = QUEUE_NAME)
	public void execute(String message) {

		byte[] bytes = message.getBytes(StandardCharsets.ISO_8859_1);
		String string = new String(bytes, Charset.forName("GBK"));
		log.info("Message info :{}", string);

	}
}
